<html>
<body>
<script src='//cdn.bootcss.com/socket.io/1.3.7/socket.io.js'></script>
<script>
    // 连接服务端
    var socket = io('http://127.0.0.1:4001');
    // 触发服务端的chat message事件
    socket.emit('joinRoom', 'msg');
    // 服务端通过emit('chat message from config', $msg)触发客户端的chat message from server事件
    socket.on('msg', function(data){
        console.log(data,66);
    });

    socket.emit('send', '消息');



</script>
</body>
</html>
